using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using NetROS.Tiers.Entities;
using System.IO;
using System.Windows.Forms;
using System.Collections.Generic;

namespace NetRosApp.Klijenti.Reports
{

    public partial class MeduskladisnicaPrijemIspis : DevExpress.XtraReports.UI.XtraReport, IParametriIzvjestaja
    {
        public MeduskladisnicaPrijemIspis()
        {
            InitializeComponent();
        }
        public MeduskladisnicaPrijemIspis(Dokument dokument)
        {
            InitializeComponent();
            bindingSource1.DataSource = dokument;

            ////System.Drawing.Imaging.Metafile tmp = new System.Drawing.Imaging.Metafile(@"H:\NetROS\NetRosApp\Slike\Reporti\zaglavlje.wmf");
            //System.Drawing.Imaging.Metafile tmp = new System.Drawing.Imaging.Metafile(Application.StartupPath + "\\zaglavlje.wmf");
            //int visina = tmp.Size.Height;
            //int duzina = tmp.Size.Width;

            //if (visina != 0)
            //{
            //    xrPictureBox1.Height = (int)(((decimal)tmp.Height / (decimal)tmp.Width) * (decimal)650);
            //}


            //xrPictureBox1.Image = tmp;


        }
        public Dictionary<string, Decimal?> _TmpDic = new Dictionary<string, decimal?>();


        #region IParametriIzvjestaja Members

        public void SetParametri()
        {
            //Dokument _tmp = bindingSource1.DataSource as Dokument;

            //if (_tmp != null)
            //{
            //    if (_tmp.DokumentDodatakCollection.Count != 0)
            //    {
            //        GroupHeader2.Visible = true;
            //        Detail3.Visible = true;
            //        GroupFooter2.Visible = true;
            //    }
            //}
            //  throw new Exception("The method or operation is not implemented.");
        }

        #endregion


        private void xrLabel10_SummaryCalculated(object sender, TextFormatEventArgs e)
        {
            //

        }
        //Decimal Sum = 0;
        //private void xrLabel1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        //{
        //    if (_TmpDic != null)
        //    {
        //        DokumentStavka _tmpdocstavka = DetailReport1.GetCurrentRow() as DokumentStavka;
        //        Dokument _tmpd = Report.GetCurrentRow() as Dokument;
        //        if (_tmpdocstavka != null && _tmpd != null)
        //        {
        //            String _foramtKljuca = "{0}|{1}|{2}";
        //            String kljuc = String.Format(_foramtKljuca, _tmpdocstavka.IDOrgJedOd, _tmpdocstavka.IDArtikl, _tmpd.Datum);
        //            Sum = Sum + (_TmpDic[kljuc].Value * Convert.ToDecimal(_tmpdocstavka.Kolicina));
        //            xrLabel1.Text = _TmpDic[kljuc].Value.ToString("n2");
        //        }
        //    }

        //}



        //private void xrLabel3_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        //{
        //    xrLabel3.Text = Sum.ToString("n2");
        //}





        //#region IIzdatnicaIspis Members

        //public Dictionary<string, decimal?> TmpDic
        //{
        //    get
        //    {
        //        return _TmpDic;
        //    }
        //    set
        //    {
        //        _TmpDic = value;
        //    }
        //}

        //#endregion

        //private void xrLabel9_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        //{
        //    if (_TmpDic != null)
        //    {
        //        DokumentStavka _tmpdocstavka = DetailReport1.GetCurrentRow() as DokumentStavka;
        //        Dokument _tmpd = Report.GetCurrentRow() as Dokument;
        //        if (_tmpdocstavka != null && _tmpd != null)
        //        {
        //            String _foramtKljuca = "{0}|{1}|{2}";
        //            String kljuc = String.Format(_foramtKljuca, _tmpdocstavka.IDOrgJedOd, _tmpdocstavka.IDArtikl, _tmpd.Datum);
        //            xrLabel9.Text = Convert.ToDecimal((_TmpDic[kljuc].Value * Convert.ToDecimal(_tmpdocstavka.Kolicina))).ToString("n2");
        //        }
        //    }
        //}
    }
}
